import type {
  DepartData,
  OrderDetail,
  OrderListData,
  OrderParams,
  OrderPreData,
  OrderPreParams,
  OrderQuery,
  PayParams,
  RateParams,
} from '@/types/consult'
import type { orderDetailData } from '@/types/orderDetail'
import { request } from '@/untils/http'

export const departmentListApi = () => {
  return request.get<null, DepartData[]>('/dep/all')
}

//问诊-支付页面-计算就诊信息和抵扣信息
export const preOrderApi = (params: OrderPreParams) => {
  return request.get<null, OrderPreData>('/patient/consult/order/pre', { params })
}

/**
 * 生成待支付订单
 */
export const createOrderApi = (data: OrderParams) => {
  return request.post<null, { id: string }>('/patient/consult/order', data)
}

/**
 * 三方支付（暂时只支持支付宝支付）
 */
export const orderPayApi = (data: PayParams) => {
  return request.post<null, { payUrl: string }>('/patient/consult/pay', data)
}
/**
 * 问诊订单详情
 */
export const orderDetailApi = (orderId: string) => {
  return request.get<null, OrderDetail>('/patient/consult/order/detail', { params: { orderId } })
}

// 问诊-订单-评价医生
// POST
// /patient/order/evaluate
export const evaluateDocApi = (data: RateParams) => {
  return request.post<null, { id: string }>('/patient/order/evaluate', data)
}

/**
 * 医生问诊列表
 */
export const orderListApi = (data: OrderQuery) => {
  return request.get<null, OrderListData>('/patient/consult/order/list', { params: data })
}

// 查询订单详情
export const getOrderDetailApi = (id:string) =>{
  return request.get<null,orderDetailData>(`/patient/consult/order/detail?orderId=${id}`)
}
